package com.gzyj.web.api.sys;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gzyj.data.common.ResponseMsg;
import com.gzyj.pojo.web.sys.BladeDict;
import com.gzyj.web.mapper.sys.BladeDictMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("api/sys/dict")
public class SysApi {


    @Autowired
    private BladeDictMapper bladeDictMapper;

    @PostMapping("getVehColors")
    public ResponseMsg<List<BladeDict>> getVehColors(){
      List<BladeDict> list=  bladeDictMapper.selectList(new QueryWrapper<BladeDict>().eq("code","colour").ne("dict_key","-1"));

        return new ResponseMsg<>(200,"success",list);
    }

    @PostMapping("getShiyongxingzhi")
    public ResponseMsg<List<BladeDict>> getShiyongxingzhi(){
        List<BladeDict> list=  bladeDictMapper.selectList(new QueryWrapper<BladeDict>().eq("code","shiyongxingzhi").ne("dict_key","-1"));

        return new ResponseMsg<>(200,"success",list);
    }

    @PostMapping("getYYZT")
    public ResponseMsg<List<BladeDict>> getYYZT(){
        List<BladeDict> list=  bladeDictMapper.selectList(new QueryWrapper<BladeDict>().eq("code","vehicle_state").ne("dict_key","-1"));

        return new ResponseMsg<>(200,"success",list);
    }

    @PostMapping("getZDJRFS")
    public ResponseMsg<List<BladeDict>> getZDJRFS(){
        List<BladeDict> list=  bladeDictMapper.selectList(new QueryWrapper<BladeDict>().eq("code","platformConnectionType").ne("dict_key","-1"));

        return new ResponseMsg<>(200,"success",list);
    }

    @PostMapping("getZDLX")
    public ResponseMsg<List<BladeDict>> getZDLX(){
        List<BladeDict> list=  bladeDictMapper.selectList(new QueryWrapper<BladeDict>().eq("code","zhongduanleixing").ne("dict_key","-1"));

        return new ResponseMsg<>(200,"success",list);
    }

    @PostMapping("getZDXYLX")
    public ResponseMsg<List<BladeDict>> getZDXYLX(){
        List<BladeDict> list=  bladeDictMapper.selectList(new QueryWrapper<BladeDict>().eq("code","terminalProtocolType").ne("dict_key","-1").orderByAsc("sort"));

        return new ResponseMsg<>(200,"success",list);
    }

    @PostMapping("getZDDFXYLX")
    public ResponseMsg<List<BladeDict>> getZDDFXYLX(){
        List<BladeDict> list=  bladeDictMapper.selectList(new QueryWrapper<BladeDict>().eq("code","dfbz").ne("dict_key","-1").orderByAsc("sort"));

        return new ResponseMsg<>(200,"success",list);
    }



}
